<script type="text/javascript">
<!--
<?php 
$all = count($dataProvider);
$addresses = $images = $names = $urls = $prices = '';
foreach ($dataProvider as $key => $object) :
	$address		= $object->country->name.', '.$object->city->name.', '.$object->street.' '.$object->house .'/'.$object->apartment;
	$image			= $object->mainImage ? 
		$this->material_image_src($object->mainImage->id, $object->mainImage->name, '205', 'images/'.$object->user_id.'/'.$object->id) : 
			$this->material_image_src(0, 'noimage.gif', '205', '');
	$url 			= Yii::app()->createUrl('cataloge/view', array('id'=>$object->id));
	$addresses 		.=  $key+1!=$all ? '"'.$address.'", ' : '"'.$address.'"';
	$images 		.=  $key+1!=$all ? '"'.$image.'", ' : '"'.$image.'"';
	$names 			.=  $key+1!=$all ? '"'.$object->name.'", ' : '"'.$object->name.'"';
	$urls 			.=  $key+1!=$all ? '"'.$url.'", ' : '"'.$url.'"';
	$prices 			.=  $key+1!=$all ? '"'.$object->price.'", ' : '"'.$object->price.'"';
endforeach;
?>
window.addresses = [<?php echo $addresses;?>];
window.images = [<?php echo $images;?>];
window.names = [<?php echo $names;?>];
window.urls = [<?php echo $urls;?>];
window.prices = [<?php echo $prices;?>];
//-->
</script>
<div id="map_canvas" style="width:800px; height:500px; "></div>
<div class="cl list-object">
	<div class="content_holder fl">
		<div id="content">
			<div class="list big">
			<?php if( $dataProvider ) : ?>
				<?php foreach ($dataProvider as $key => $object) : ?>
					<div class="object <?php echo ($key+1)%3==0 && $key!=0 ? 'third' : '';?>">
						<div class="object-price"><span><?php echo Yii::t("main", "from")?></span> <?php echo CHtml::encode($object->price); ?> €</div>
						<div class="object-img">
							<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$object->id)); ?>" title="<?php echo CHtml::encode($object->name); ?>">
								<?php if($object->mainImage){ ?>
									<?php echo $this->material_image($object->mainImage->id, $object->mainImage->name, '205', 'images/'.$object->user_id.'/'.$object->id); ?>
								<?php }else{ ?>
									<?php echo $this->material_image(0, 'noimage.gif', '205', ''); ?>
								<?php } ?>
							</a>
						</div>
						<h3 class="object-name">
							<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$object->id)); ?>" title="<?php echo CHtml::encode($object->name); ?>" class=""><?php echo CHtml::encode($object->name); ?></a>
						</h3>
						<?php if(isset($object->roomType)):?>
						<p><?php echo CHtml::encode($object->roomType->name); ?></p>
						
						<p class="descr"><?php echo CHtml::encode($object->description); ?></p>
						<?php endif;?>
						<p class="btns">
							<a href="<?php echo Yii::app()->createUrl('cataloge/update',array('id'=>$object->id)); ?>"><span class="btn br3 fl"><?php echo Yii::t('main','Edit') ?></span></a>
							<a href="<?php echo Yii::app()->createUrl('cataloge/view',array('id'=>$object->id)); ?>"><span class="btn br3 fl"><?php echo Yii::t('main','View') ?></span></a>
							<a href="<?php echo Yii::app()->createUrl('users/booking',array('id'=>$object->id)) ?>"><span class="btn br3 fl"><?php echo Yii::t('main','Booking') ?></span></a>
						</p>
						<?php $address = $object->country->name.', '.$object->city->name.', '.$object->street.' '.$object->house .'/'.$object->apartment;?>
						<a href="#" class="onmap showMap" title="<?php echo $address?>"><?php echo $address?></a>
					</div>
				<?php endforeach; ?>
			<?php else : ?>
				<div class="row cl">
					<div class="message error br3"><?php echo Yii::t('main', 'You dont have objects'); ?></div>
				</div>
			<?php endif ?>
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<!-- Right col -->
	<div id="right" class="br5">
		<div class="order_form">
			<!-- right menu Cabinet -->
			<?php $this->renderPartial('../users/_menu_r_Cabinet'); ?>
		</div>
	</div>
</div>
